import Vue from "vue";
import VueRouter from "vue-router";
//首页
import Home from "@/views/lj/homeContent.vue";
import layout from "@/views/lj/layout.vue";
import Mhome from "@/views/lj/mobileIndex";

// import scienceEntry from "@/views/fyx/scienceEntry";

// import scienceAticle from "@/views/fyx/scienceAticle";

// import news from "@/views/cl/News";
// 导览页面
// import guidedPage from "@/views/yc/guidedPage.vue"

// import searchPage from "@/views/yc/searchPage.vue"

// import Museum3 from "@/views/ll/museum3";
// // 博物馆2
// import Museum2 from "@/views/frx/museum2";

// 载入词条详情页
import detailedPage from "@/views/yc/detailedPage";

// 路由懒加载
const login = () =>
  import(/*webpackChunkName:"login"*/ "@/views/frx/login.vue"); //登录
const register = () =>
  import(/*webpackChunkName:"register"*/ "@/views/frx/register.vue"); //注册
const userInfor = () =>
  import(/*webpackChunkName:"userInfor"*/ "@/views/frx/userInfor.vue");
const retrievePwd = () =>
  import(/*webpackChunkName:"retrievePwd"*/ "@/views/frx/retrievePwd.vue");
const retrievePwd2 = () =>
  import(/*webpackChunkName:"retrievePwd2"*/ "@/views/frx/retrievePwd2.vue");

const scienceEntry = () =>
  import(/*webpackChunkName:"scienceEntry"*/ "@/views/fyx/scienceEntry"); // 科普词条页面
const scienceAticle = () =>
  import(/*webpackChunkName:"scienceAticle"*/ "@/views/fyx/scienceAticle"); // 科普文章页面

const news = () => import(/*webpackChunkName:"News"*/ "@/views/cl/News"); // 新闻页面

const guidedPage = () =>
  import(/*webpackChunkName:"guidedPage"*/ "@/views/yc/guidedPage.vue"); // 导览页面
const searchPage = () =>
  import(/*webpackChunkName:"searchPage"*/ "@/views/yc/searchPage.vue"); // 搜索页面

const museum3 = () =>
  import(/*webpackChunkName:"museum3"*/ "@/views/ll/museum3"); // 博物馆3

// const museum3 = () => import( /*webpackChunkName:"museum3"*/ "@/views/lj/mobileIndex")// 移动端首页

Vue.use(VueRouter);

const routes = [
  {
    path: "/",
    name: "layout",
    component: layout,
  },
  {
    path: "/pc",
    component: layout,
    redirect: "/pc/home",
    name: "pc",
    meta: {},
    children: [
      {
        path: "home",
        component: Home,
        name: "主页",
        meta: { keepAlive: true },
      },
      {
        path: "scienceEntry",
        component: scienceEntry,
        name: "科普词条页面",
      },
      {
        path: "scienceAticle",
        component: scienceAticle,
        name: "科普文章页面",
      },
      {
        path: "news",
        component: news,
        name: "新闻页面",
      },
      {
        path: "guidedPage",
        component: guidedPage,
        name: "导览页面",
      },
      {
        path: "searchPage",
        component: searchPage,
        name: "搜索页面",
      },
      {
        path: "museum3",
        component: museum3,
        name: "博物馆简介",
      },
      {
        path: "login",
        component: login,
        name: "登录",
      },
      {
        path: "register",
        component: register,
        name: "注册",
      },
      {
        path: "userInfor",
        name: "添加信息",
        component: userInfor,
      },
      {
        path: "retrievePwd",
        name: "修改密码",
        component: retrievePwd,
      },
      {
        path: "retrievePwd2",
        name: "修改密码1",
        component: retrievePwd2,
      },
    ],
  },
  {
    path: "/mobile",
    component: layout,
    redirect: "/mobile/home",
    name: "mobile",
    meta: {},
    children: [
      {
        path: "home",
        component: Mhome,
        name: "首页",
        meta: { keepAlive: true },
      },
    ],
  },
  // {
  //   path: "/scienceEntry",
  //   component: scienceEntry
  // },
  // {
  //   path: "/scienceAticle",
  //   component: scienceAticle
  // },
  // {
  //   path: "/news",
  //   component: news
  // },
  // {
  //   path: "/guidedPage",
  //   component: guidedPage
  // },
  // {
  //   path: "/searchPage",
  //   component: searchPage
  // },
  // // login
  // {
  //   path: '/login',
  //   name: 'login',
  //   component: login
  // },
  // {
  //   path: '/register',
  //   name: 'register',
  //   component: register
  // },
  // {
  //   path: '/userInfor',
  //   name: 'userInfor',
  //   component: userInfor
  // },
  // {
  //   path: '/retrievePwd',
  //   name: 'retrievePwd',
  //   component: retrievePwd
  // },
  // {
  //   path: '/retrievePwd2',
  //   name: 'retrievePwd2',
  //   component: retrievePwd2
  // },
  {
    path: "/news",
    component: news,
  },
  {
    path: "/guidedPage",
    component: guidedPage,
  },
  {
    path: "/searchPage",
    component: searchPage,
  },
  {
    path: "/detailedPage",
    component: detailedPage,
  },
  // login
  {
    path: "/login",
    component: login,
  },
  {
    path: "/register",
    component: register,
  },
  {
    path: "/userInfor",
    component: userInfor,
  },
  {
    path: "/retrievePwd",
    component: retrievePwd,
  },
  {
    path: "/retrievePwd2",
    component: retrievePwd2,
  },
  // museum3
  // {
  //   path: '/museum3',
  //   component: Museum3
  // },
  // {
  //   path: '/museum2',
  //   component: Museum2
  // }
];

const router = new VueRouter({
  scrollBehavior(to, from, savedPosition) {
    if (savedPosition) {
      return savedPosition;
    } else {
      return { x: 0, y: 0 };
    }
  },
  routes,
});

export default router;
